The present invention relates to a data processing apparatus which transmits or receives to and from devices to be controlled, each having a storage device, such as a plurality of programmable controllers (hereinafter referred to as xe2x80x9cPCsxe2x80x9d), data reserved in the PCs such as a PC execution program, parameters, or device data, by means of PC communications means.
An example of a conventional data processing apparatus will now be described by reference to FIGS. 7 through 13.
FIG. 7 is a block diagram showing the configuration of a PC peripheral apparatus which is connected to two types of PCs and serves as a data processing device. In the drawing, reference numeral 1 designates a PC peripheral apparatus for controlling a CRT 2, a keyboard 3, and a mouse 4, which serve as input/output devices, and PC 6a and PC 6b connected to the PC peripheral apparatus by means of a communications line. Reference numeral 2 designates a CRT; 3 designates a keyboard; 4 designates a mouse; and 5 designates an auxiliary storage device. The auxiliary storage device 5 stores a monitoring program file 14A which collects device data from the PC 6a or 6b and displays the contents of the thus-collected device data on the CRT 2; an application program, such as a programming function program 15A, for offering a program development environment which prepares a user program for activating the PC 6a or 6c; and a PC communications means file 16 by means of which the monitoring program 14A and the programming function program file 15A communicate with the PC 6a or 6b. 
Reference numeral 6 designates a PC which is connected to the PC peripheral apparatus 1 by way of a communications line and comprises the two PC 6a and PC 6b, whose internal memory devices differ in configuration from each other.
In the PC peripheral apparatus 1, reference numeral 7 designates a CPU which executes a program for communicating with the PC 6; 8 designates work-area memory for software which establishes communication between the PC peripheral apparatus 1 and the PC 6a and PC 6b; 9 designates an interface with the CRT 2; 10 designates an interface with the keyboard 3; 11 designates an interface with the mouse 4; 12 designates an interface with the auxiliary storage device 5; and 13 designates an interface with the PC 6a and PC 6b. 
In the work-area memory 8, the monitoring program 14A, the programming function program 15A, and the PC communications means 16, which are stored in the auxiliary storage device 5, are expanded.
There is no requirement that the PC peripheral apparatus 1 be a dedicated apparatus. The PC peripheral apparatus 1 may be a commercially available personal computer, so long as the apparatus is equipped with at least the previously-described elements.
FIG. 8 is a memory status diagram representing the configuration of memory stored in the PC 6, showing the status of memory of the two types of PC 6a and PC 6b. 
In the drawing, the internal memory of the PC 6 comprises: a parameter 100 which sets a program capacity required for activating the PC 6; a program 101 which is prepared by the user through use of the programming function program 15A and activates the PC 6; device memory 102 represented by designations, such as xe2x80x9cX,xe2x80x9d xe2x80x9cY,xe2x80x9d xe2x80x9cT,xe2x80x9d and xe2x80x9cC,xe2x80x9d which abstractly express storage areas of bit or word size; device memory 102 which is an area of the PC 6 whose value is changed in accordance with the operation of a program; PC-type data 103 which include type-dependent data such as a type code; and PC internal data 104 which are prepared internally for the purpose of activating the PC 6. Addresses 105 at which the above elements are stored are determined.
Reference numeral 106 designates a diagram for specifically showing the status of memory of a device X, representing, for example, bit regions.
The memory of the PC 6a comprises a parameter 100a, a program 101a, device memory 102a, PC-type data 103a, PC internal data 104a, and an address 105a. The memory of the PC 6b comprises a parameter 10b, a program 101b, device memory 102b, PC-type data 103b, PC internal data 104b, and an address 105b. Although the memory devices of the PC 6a and PC 6b differ in configuration from each other according to the type of the PC, they have substantially the same functions.
FIG. 9 shows the configuration of the software which is executed in the work-area memory 8 of the PC peripheral apparatus and the flow of data exchanged between the work-area memory 8 and the PC 6a and PC 6b. As shown in the drawing, the software that runs on the work-area memory 8 is stored in the auxiliary storage device 5 and starts operation by being activated by the user through use of the keyboard 3 or the mouse 4. The monitoring program 14A comprises PC access data 14a used for establishing communication with the PC 6a or 6b, and unique address data 14b storing an address specifying which of the PC 6a and PC 6b access is made. The programming function program 15A comprises PC access data 15a used for establishing communication with the PC 6a or 6b, and unique address data 15b reserving an address specifying which of the PC 6a and PC 6b access is made.
The PC communications means 16 for exchanging data with the PC 6a and PC 6b is equipped with programs compatible with mediums such as serial interfaces RS232C and RS422 and Ethernet. When data are transmitted to or received from the PC 6a or 6b, the monitoring program 14A and the programming function program 15A receive or transmit data through use of the PC communications means 16. The monitoring program 14A and the programming function program 15A are exclusively controlled so as to avoid using the same medium; e.g. , the RS232C interface, simultaneously.
FIG. 10 shows the configuration of PC access data executed in the work-area memory 8 of the PC peripheral apparatus.
In the drawing, reference numeral 14a designates PC access data of the monitoring program 14A. The PC access data 14a comprises a tag 141a; i.e., device data for specifying which of the PC 6a and PC 6b is to be monitored; and device data 142a which represents the status of devices of the respective PC 6a and PC 6b; for example, ON status of an input X0 device. Reference numeral 15a designates PC access data of the programming function program 15A. The PC access data 15a comprises a program 151a for activating the PC prepared by the user; a program comment 152a for making the program 151a easy to understand; a device comment 153a assigned to devices of the PC 6a and PC 6b; a parameter 154a storing definitions required for activating the PC 6a or 6b; and device data 155a which represent the status of devices of the PC 6a and PC 6b; for example, the ON status of an input X0 device.
FIG. 11 shows address data unique to the software executed in the work-area memory of the PC peripheral apparatus.
In the drawing, reference numerals 14b and 15b respectively designate unique address data comprising a PC memory header address; a work-area header address for saving a parameter; a file register segment header address, a monitor work-area header address, and a device register header address. The unique address data 14b and 15b represent header addresses at which data unique to the respective PCs are stored.
FIG. 12 is a schematic flowchart of a program of the PC communications means 16 that exchanges data with the PC 6a or 6b. 
The PC communications means 16 is called to start operation by the monitoring program 14A and the programming function program 15A when there arises a need for exchanging data with the PC 6a or 6b. 
In step S101, a determination is made as to with which of the PCs communication is made. In step 102 or S112, a check is made as to whether or not the interface 13 of the target PC is used by the monitoring program 14A or the programming function program 15A, by means of the function of an OS 17, such as a semaphore.
If it is determined in step S102 or S112 that the interface 13 is used, processing returns to main processing. In contrast, if the interface 13 is determined not to be used, a semaphore is set in step S103 or S113 in order to represent that the interface 13 is in use. In order to prepare a report data block (hereinafter referred to as a xe2x80x9cpacketxe2x80x9d) to be exchanged, the address data 14b or 15b unique to the target PC that is stored in the monitoring program 14A or the programming function program 15A (step S104 or S114) is referred to, whereby a request packet to be sent to the PC 6 which is the object of communication is prepared (step S105 or S115).
In step S106 or S116, the thus-prepared packet is transmitted to the target PC 6.
In step S107 or S117, the PC peripheral apparatus awaits a response packet sent from the PC 6. If the PC peripheral apparatus receives a response packet from the PC, processing in response to the response packet is performed in step S108 or S118. Finally, in step S109 or S119, the semaphore is reset to terminate communication, and processing returns to the main program.
FIG. 13 shows a request packet to be sent to the PC. In the drawing, reference 18 designates a request packet comprising a request code 181, a data length 182, and data 183.
Particularly, reference numeral 18a designates a PC 6a packet used when the programming function program 15A makes a request to the PC 6a for reading 100 bytes of data from the memory of the PC.
Reference numeral 181a designates a request code used when the programming function program 15A makes a request to the PC 6a for reading data from the memory of the PC, and the request code 181a includes xe2x80x9cmemory read 2,xe2x80x9d for example. Reference numeral 182a designates a data length representing the length of data, and the data length 182a includes xe2x80x9cdata length 3,xe2x80x9d for example. Reference numeral 183a designates data used for reading 100 bytes of data from the memory of the PC, and the data 183a includes a xe2x80x9cheader addressxe2x80x9d and a xe2x80x9cby length 100,xe2x80x9d which are acquired from the unique address data 14b and 15b (i.e., PC memory header addresses).
The packet is changed according to the type of the PC and a communications medium. The header address 183a must be set through use of the unique address data 14b and 15b of respective application programs.
As mentioned above, when exchanging data with a PC, the conventional PC peripheral apparatus retains and handles within a program area address data unique to the PC and PC access data. As a result, application programs such as a programming function program and a monitoring program become larger in size and more complicated. Complication of the application programs hinders an increase in processing speed.
If any change, such as the change of an address, arises in the PC itself, and the configuration of the packet is changed, or if another PC is further added to the PC peripheral apparatus, the PC access data and unique address data must be changed, which in turn involves changing of internal processing of the respective programs.
Transmission of data to the internal memory of the PC and receipt of data from the internal memory of the PC are directly performed with respect to actual memory by the respective programs. Further, the data are processed before transmission or after receipt. by means of internal processing of the program. For these reasons, data must be processed at all times through use of data configuration matching the specification of the PC, thereby complicating the processing.
The present invention has been conceived to solve the foregoing problems, and a data processing apparatus is provided with a communications manager for managing communication with a device to be controlled. Data are exchanged between the data processing apparatus and the device to be controlled by way of the communications manager. Data unique to each of the devices to be controlled are held in the data processing apparatus in the form of application programs. An application program, which exchanges data with the device to be controlled, does not need to perform data processing depending on the type of device to be controlled and may be performed according to predetermined procedures.
To achieve the above object, there is provided a data processing apparatus comprising:
an application program which makes a request through use of a unified common packet in order to control a device to be controlled connected to the data processing apparatus by way of a communications line;
a communications manager which receives the common packet from the application program and converts the common packet into a real packet for submitting a control request to the connected device to be controlled; and
communications means which outputs the real packet converted by the communications manager to the device to be controlled.
Preferably, the communications manager acquires retained data according to the details of the request set in the common packet and converts the data into an actual packet.
Preferably, the data acquired by the communications manager correspond to address data for which an internal data area is set in the device to be controlled which serves as an object of transmission of the real packet.
Preferably, the communications manager comprises:
request command classification means which receives the common packet from the applications program and outputs a virtual packet corresponding to the device to be controlled, on the basis of the number of a device to be controlled set in the common packet;
resource management means for managing data used for establishing connection with the device to be controlled; and
means for preparing a packet according to the type of a device which prepares an actual packet on the basis of the virtual packet output from the request command classification means and the data acquired by the resource management means.
Preferably, when preparing an actual packet on the basis of a virtual packet, the means for preparing a packet according to the type of a device outputs a resource request packet to the resource management means, thereby acquiring data from the resource management means.
There is also provided a data processing apparatus comprising:
an application program which makes a request through use of a unified common packet in order to control a device to be controlled connected to the data processing apparatus by way of a communications line;
a communications manager which receives the common packet from the application program, converts the common packet into a real packet for submitting a control request to the connected device to be controlled, and virtually executes the operation of the device to be controlled ; and
emulation means which emulates the operation of the device on the basis of the actual packet converted by the communications manager and sends the result of such emulation to the application program by way of the communications manager.